remquo
From cppreference.com
| Defined in header <math.h>
|
||
| float remquof( float x, float y, int *quo ); |
(since C99) | |
| double remquo( double x, double y, int *quo ); |
(since C99) | |
| long double remquol( long double x, long double y, int *quo ); |
(since C99) | |
Computes the remainder of the floating point division operation x/y as the remainder() function does. Additionally, the sign and at least the three of the last bits of x/y will be stored in quo.
Contents |
[edit] Parameters
| x, y | - | floating point values |
| quo | - | pointer to an integer value to store some bits of x/y in |
[edit] Return value
Remainder of dividing arguments.
[edit] Example
remqo <-- 5.1 - (5.1/3.0) * 3.0
5.1 - (1.7) * 3.0
5.1 - (2.0) * 3.0 (rounded to nearest integer)
5.1 - 6.0
-0.9
quo <-- (int)2.0
Run this code
#include <stdio.h> #include <math.h> int main() { int quo=0; printf(" quo\n"); printf(" ---\n"); printf("remquo(+5.1,+3.0,&quo) = %+.1f", remquo(+5.1,+3.0,&quo)); printf(" %+2d\n", quo); printf("remquo(-5.1,+3.0,&quo) = %+.1f", remquo(-5.1,+3.0,&quo)); printf(" %+2d\n", quo); printf("remquo(+5.1,-3.0,&quo) = %+.1f", remquo(+5.1,-3.0,&quo)); printf(" %+2d\n", quo); printf("remquo(-5.1,-3.0,&quo) = %+.1f", remquo(-5.1,-3.0,&quo)); printf(" %+2d\n", quo); return 0; }
Output:
quo
---
remquo(+5.1,+3.0,&quo) = -0.9 +2
remquo(-5.1,+3.0,&quo) = +0.9 -2
remquo(+5.1,-3.0,&quo) = -0.9 -2
remquo(-5.1,-3.0,&quo) = +0.9 +2[edit] See also
| (C99) |
signed remainder of the division operation (function) |
| remainder of the floating point division operation (function) | |
| (C99) |
the quotient and remainder of integer division (function) |
| C++ documentation for remquo
| |